package cn.xutongxue.common.enums;

import lombok.Getter;

/**
 * 错误码枚举类
 */
@Getter
public enum Errors {

    // ==================== 系统级错误 ====================
    INTERNAL_SERVER_ERROR(500100, "系统内部错误"),
    DATABASE_ERROR(500101, "数据库操作失败"),
    NETWORK_ERROR(500102, "网络异常"),

    // ==================== 权限和身份认证错误 ====================
    NOT_LOGIN_ERROR(401100, "未登录"),
    FORBIDDEN(401101, "权限不足"),
    TOKEN_EXPIRED(401102, "Token已过期"),
    INVALID_TOKEN(401103, "无效Token"),
    USERNAME_OR_PASSWORD_ERROR(401104, "用户名或密码错误"),

    // ==================== 业务逻辑错误 ====================
    OPERATION_FAILED(100100, "操作失败"),
    ITEM_NOT_FOUND(100101, "数据不存在"),
    USER_ALREADY_EXISTS(100102, "用户已存在"),
    USER_DISABLED(100103, "用户被禁用"),


    PARAMS_ERROR(400100, "参数错误"),

    // ==================== 未知错误 ====================
    UNKNOWN_ERROR(999999, "未知错误");

    private final int code;
    private final String message;

    Errors(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
